package com.computer.datebase;

import java.util.HashSet;
import java.util.Set;

import com.computer.product.Computer;


public class DateBase {
	
	static Set<Computer> set = new HashSet<>();
	
	static String[] brandlist = {"联想","惠普","华为","戴尔","华硕","宏碁"};
	static String[] colorlist = {"红色","白色","黑色"};
	
	static {
		for(int i = 0;i < 10;i++) {
			Computer c = new Computer();
			c.setBrand(brandlist[i%brandlist.length]);
			c.setColor(colorlist[i%colorlist.length]);
			c.setPrice(6000+i*10);
			set.add(c);
		}
	}
	
	
	public static Set<Computer> getAll(){
		return set;
	}
	
	public static Computer getOne(String i) {
		for(Computer p : set) {
			if(p.getBrand() == i) {
				return p;
			}
		}
		return null;
	}
	
	
	
	
	
	

}
